package ofxdownloader;

import java.util.Date;

/**
 * This class represents an OFX request object for retrieving a statement
 * when given the appropriate account and date range information
 * @author Alex Spurling
 *
 */
public class StatementRequest implements OFXRequest {

	private String request;
	
	public StatementRequest(Account account, Date fromDate, Date toDate, SignOnInfo signOnInfo) {
		String requestID = OFXRequestBuilder.generateID();
		String header = OFXRequestBuilder.getOFXHeader(null, requestID);
		String signOnRequest = OFXRequestBuilder.getSignOnRequest(signOnInfo.getUserID(), signOnInfo.getUserPass());
		
		String statementRequest = OFXRequestBuilder.getStatementRequest(account, fromDate, toDate);

		request = OFXRequestBuilder.getCompleteRequest(header, signOnRequest + statementRequest);
	}

	public String toString() {
		return request;
	}

}
